package com.returns_details.model;

import java.sql.Date;
import java.util.List;

public class Returns_detailsService {

	private Returns_detailsDAO_interface dao;

	public Returns_detailsService() {
		dao = new Returns_detailsDAO();
	}

	public Returns_detailsVO addReturns_details(
	  Long returns_id,
	  Integer product_id,
	  Integer r_number,
	  Integer r_realnum) {
		
		Returns_detailsVO returns_detailsVO = new Returns_detailsVO();
		
		returns_detailsVO.setReturns_id(returns_id);
		returns_detailsVO.setProduct_id(product_id);
		returns_detailsVO.setR_number(r_number);
		returns_detailsVO.setR_realnum(r_realnum);    

		dao.insert(returns_detailsVO);

		return returns_detailsVO;
	}

	public Returns_detailsVO updateReturns_details(	 
	  Long returns_id,
	  Integer product_id,
	  Integer r_number,
	  Integer r_realnum) {

		Returns_detailsVO returns_detailsVO = new Returns_detailsVO();
		
		returns_detailsVO.setReturns_id(returns_id);
		returns_detailsVO.setProduct_id(product_id);
		returns_detailsVO.setR_number(r_number);
		returns_detailsVO.setR_realnum(r_realnum);  
		
		dao.update(returns_detailsVO);

		return returns_detailsVO;
	}

	public void deleteReturns_details(Long returns_id) {
		dao.delete(returns_id);
	}

	public Returns_detailsVO getOneEmp(Long returns_id) {
		return dao.findByPrimaryKey(returns_id);
	}

	public List<Returns_detailsVO> getAll() {
		return dao.getAll();
	}
}
